Last active
August 29, 2015 14:28
-
-
Save coa00/831874062ad7210d2735 to your computer and use it in GitHub Desktop.
cssファイル使わずにjavascriptのみで簡単にスタイルをあてる。 ref: http://qiita.com/coa00@github/items/29c6d2b65f1ec19529da
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hoge { | |
background-color: #fff; | |
} | |
.hoge:hover { | |
border: 1px solid #0097cf; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hoge.css | |
fuga.js | |
test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var css = '<style type="text/css">\ | |
.hoge {\ | |
background-color: #fff;\ | |
}\ | |
.hoge:hover {\ | |
border: 1px solid #0097cf;\ | |
}\ | |
</style>'; | |
$(body).append($('css')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hoge { | |
background-color: #fff; | |
} | |
.hoge:hover { | |
border: 1px solid #0097cf; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('templates', function(){ | |
var src = "./src/css/"; | |
var dest = src+'templates/build';//出力場所 | |
gulp.src(src+'/*.css') | |
.pipe(handlebars()) | |
.pipe(wrap('Handlebars.template(<%= contents %>)')) | |
.pipe(declare({ | |
namespace: 'App.css', | |
noRedeclare: true // Avoid duplicate declarations | |
})) | |
.pipe(concat('style.js')) | |
.pipe(gulp.dest(dest)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var css = '<style type="text/css">\ | |
.hoge {\ | |
background-color: #fff;\ | |
}\ | |
.hoge:hover {\ | |
border: 1px solid #0097cf;\ | |
}\ | |
</style>'; | |
$(body).append($('css')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("body").append(App.css.style); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("body").append(App.css.style); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('templates', function(){ | |
var src = "./src/css/"; | |
var dest = src+'templates/build';//出力場所 | |
gulp.src(src+'/*.css') | |
.pipe(handlebars()) | |
.pipe(wrap('Handlebars.template(<%= contents %>)')) | |
.pipe(declare({ | |
namespace: 'App.css', | |
noRedeclare: true // Avoid duplicate declarations | |
})) | |
.pipe(concat('style.js')) | |
.pipe(gulp.dest(dest)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("body").append(App.css.style); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
.hoge { | |
background-color: #fff; | |
} | |
.hoge:hover { | |
border: 1px solid #0097cf; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment