8 |
14 |
15 |
16 |
17 |
18 | sprintf( '
', esc_attr( $service_class ) ),
23 | 'after' => '
',
24 | ]
25 | );
26 | ?>
27 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/components/parts/common/skip-links.php:
--------------------------------------------------------------------------------
1 |
4 |
6 |
7 |
10 |
15 | 'fr-header__operator' ] );
19 | get_template_part( 'components/parts/header/header-navbar' );
20 | ?>
21 |
22 | 'fr-header__service' ] );
24 | ?>
25 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/components/parts/header/header-menu.php:
--------------------------------------------------------------------------------
1 |
4 |
27 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/components/parts/header/header-navbar.php:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/components/parts/header/header-tools-link.php:
--------------------------------------------------------------------------------
1 |
6 |
19 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/components/parts/header/header.php:
--------------------------------------------------------------------------------
1 |
4 |
10 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/components/parts/single/latest-posts.php:
--------------------------------------------------------------------------------
1 | 'post',
8 | 'posts_per_page' => 4,
9 | 'post__not_in' => [ get_the_ID() ],
10 | 'no_found_rows' => true,
11 | ]
12 | );
13 |
14 | if ( ! $posts_query->have_posts() ) {
15 | return;
16 | }
17 | ?>
18 |
19 |
20 |
21 | get_post_type_archive_link( 'post' ),
25 | 'class' => 'fr-link fr-icon-arrow-right-line fr-link--icon-right',
26 | ],
27 | [
28 | 'content' => __( 'Voir toute l’actualité', 'wp-dsfr-theme' ),
29 | 'before' => '
',
30 | 'after' => '
',
31 | ]
32 | );
33 | ?>
34 |
35 | have_posts() ) :
37 | $posts_query->the_post();
38 | get_template_part( 'components/loops/card-post', '', [ 'heading_level' => 3 ] );
39 | endwhile;
40 |
41 | wp_reset_postdata();
42 | ?>
43 |
44 |
45 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/config/dsfr.js:
--------------------------------------------------------------------------------
1 | /**
2 | * DSFR
3 | *
4 | * This task copy folders from node_modules/@gouvfr/dsfr/dist/
5 | * in order to recreate the DFSR recommended implementation :
6 | * https://github.com/GouvernementFR/dsfr
7 | *
8 | * Files are then loaded from inc/Services/Assets.php
9 | */
10 | const fs = require('fs')
11 |
12 | const dsfrNodeModulesDistPath = './node_modules/@gouvfr/dsfr/dist/'
13 | const dsfrThemeDistFolderName = 'dist-dsfr'
14 | const assets = [
15 | 'artwork/',
16 | 'fonts/',
17 | 'icons/',
18 | 'utility/utility.css',
19 | 'utility/utility.min.css',
20 | 'dsfr.css',
21 | 'dsfr.min.css',
22 | 'dsfr.module.js',
23 | 'dsfr.module.min.js',
24 | ];
25 |
26 | if (!fs.existsSync(dsfrNodeModulesDistPath)) {
27 | return
28 | }
29 |
30 | if (fs.existsSync( dsfrThemeDistFolderName)) {
31 | fs.rmSync( dsfrThemeDistFolderName, {recursive: true, force: true})
32 | }
33 |
34 | fs.mkdirSync( dsfrThemeDistFolderName)
35 |
36 | for (let i = 0; i < assets.length; i++) {
37 | fs.cpSync(
38 | dsfrNodeModulesDistPath + assets[i],
39 | dsfrThemeDistFolderName + '/' + assets[i],
40 | {
41 | recursive: true,
42 | }
43 | )
44 | }
45 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/config/entries.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | app: ['./src/js/index.js', './src/scss/style.scss'],
3 | editor: ['./src/js/editor.js', './src/scss/editor.scss'],
4 | 'post-build': './src/js/post-build.js',
5 | login: './src/scss/login.scss',
6 | }
7 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/config/plugins.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const { CleanWebpackPlugin } = require('clean-webpack-plugin')
3 | const { WebpackManifestPlugin } = require('webpack-manifest-plugin')
4 | const ESLintPlugin = require('eslint-webpack-plugin')
5 | const MiniCssExtractPlugin = require('mini-css-extract-plugin')
6 | const StyleLintPlugin = require('stylelint-webpack-plugin')
7 | const SpriteLoaderPlugin = require('svg-sprite-loader/plugin')
8 | const WebpackBar = require('webpackbar')
9 | const DependencyExtractionWebpackPlugin = require('@wordpress/dependency-extraction-webpack-plugin')
10 |
11 | module.exports = {
12 | get: function (mode) {
13 | const plugins = [
14 | new CleanWebpackPlugin(),
15 | new ESLintPlugin({
16 | overrideConfigFile: path.resolve(__dirname, '../.eslintrc'),
17 | context: path.resolve(__dirname, '../src/js'),
18 | files: '**/*.js',
19 | }),
20 | new SpriteLoaderPlugin({
21 | plainSprite: true,
22 | }),
23 | new StyleLintPlugin({
24 | configFile: path.resolve(__dirname, '../.stylelintrc'),
25 | context: path.resolve(__dirname, '../src/scss'),
26 | files: '**/*.scss',
27 | }),
28 | new WebpackBar({
29 | color: '#ffe600',
30 | }),
31 | new DependencyExtractionWebpackPlugin(),
32 | ]
33 |
34 | if (mode === 'production') {
35 | plugins.push(
36 | new WebpackManifestPlugin({
37 | fileName: 'assets.json',
38 | }),
39 | new MiniCssExtractPlugin({
40 | filename: '[name].[contenthash:8].min.css',
41 | })
42 | )
43 | } else {
44 | plugins.push(
45 | new MiniCssExtractPlugin({
46 | filename: '[name].css',
47 | })
48 | )
49 | }
50 |
51 | return plugins
52 | },
53 | }
54 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/config/svgo.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: [
3 | { cleanupAttrs: true },
4 | { removeDoctype: true },
5 | { removeXMLProcInst: true },
6 | { removeComments: true },
7 | { removeMetadata: true },
8 | { removeTitle: true },
9 | { removeDesc: true },
10 | { removeUselessDefs: true },
11 | { removeEditorsNSData: true },
12 | { removeEmptyAttrs: true },
13 | { removeHiddenElems: true },
14 | { removeEmptyText: true },
15 | { removeEmptyContainers: true },
16 | { cleanupEnableBackground: true },
17 | { convertStyleToAttrs: true },
18 | { convertColors: true },
19 | { convertPathData: true },
20 | { convertTransform: true },
21 | { removeUnknownsAndDefaults: true },
22 | { removeNonInheritableGroupAttrs: true },
23 | { removeUselessStrokeAndFill: true },
24 | { removeUnusedNS: true },
25 | { cleanupIDs: true },
26 | { cleanupNumericValues: true },
27 | { moveElemsAttrsToGroup: true },
28 | { moveGroupAttrsToElems: true },
29 | { collapseGroups: true },
30 | { removeRasterImages: false },
31 | { mergePaths: true },
32 | { convertShapeToPath: true },
33 | { sortAttrs: true },
34 | { removeDimensions: false },
35 | { prefixIds: true },
36 | { removeViewBox: false },
37 | ],
38 | }
39 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/config/webpack.common.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const entries = require('./entries')
3 | const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin')
4 | const TerserPlugin = require('terser-webpack-plugin')
5 | const svgoconfig = require('./svgo.config')
6 |
7 | module.exports = {
8 | entry: entries,
9 | output: {
10 | filename: '[name].js',
11 | path: path.resolve(__dirname, '../dist'),
12 | publicPath: '',
13 | assetModuleFilename: 'assets/[hash][ext][query]',
14 | },
15 | optimization: {
16 | minimizer: [
17 | new ImageMinimizerPlugin({
18 | minimizer: {
19 | implementation: ImageMinimizerPlugin.imageminMinify,
20 | options: {
21 | // Lossless optimization with custom option
22 | // Feel free to experiment with options for better result for you
23 | plugins: [
24 | ['gifsicle', { interlaced: true }],
25 | ['jpegtran', { progressive: true }],
26 | ['optipng', { optimizationLevel: 5 }],
27 | // Svgo configuration here https://github.com/svg/svgo#configuratio
28 | ['svgo', { svgoconfig }],
29 | ],
30 | },
31 | },
32 | }),
33 | new TerserPlugin({
34 | parallel: true,
35 | terserOptions: {
36 | format: {
37 | comments: /translators:/i,
38 | },
39 | compress: {
40 | passes: 2,
41 | },
42 | mangle: {
43 | reserved: ['__', '_n', '_nx', '_x'],
44 | },
45 | },
46 | extractComments: false,
47 | }),
48 | ],
49 | },
50 | externals: {
51 | jquery: 'window.jQuery',
52 | },
53 | }
54 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/config/webpack.dev.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const { merge } = require('webpack-merge')
3 | const common = require('./webpack.common.js')
4 | const plugins = require('./plugins')
5 | const loaders = require('./loaders')
6 | const mode = 'development'
7 |
8 | module.exports = merge(common, {
9 | mode: mode,
10 | stats: 'errors-only',
11 | devtool: 'inline-source-map',
12 | devServer: {
13 | contentBase: path.join(__dirname, 'public'),
14 | },
15 | plugins: plugins.get(mode),
16 | module: {
17 | rules: loaders.get(mode),
18 | },
19 | })
20 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/config/webpack.prod.js:
--------------------------------------------------------------------------------
1 | const { merge } = require('webpack-merge')
2 | const common = require('./webpack.common.js')
3 | const plugins = require('./plugins')
4 | const loaders = require('./loaders')
5 | const mode = 'production'
6 |
7 | module.exports = merge(common, {
8 | mode: mode,
9 | stats: 'minimal',
10 | output: {
11 | filename: '[name]-min.js',
12 | },
13 | optimization: {
14 | concatenateModules: true,
15 | },
16 | plugins: plugins.get(mode),
17 | module: {
18 | rules: loaders.get(mode),
19 | },
20 | })
21 |
--------------------------------------------------------------------------------
/wp-dsfr-theme/footer.php:
--------------------------------------------------------------------------------
1 |
2 |
8 |